package cn.jiyun.user.service.impl;

import cn.jiyun.user.entity.Shop;
import cn.jiyun.user.mapper.ShopMapper;
import cn.jiyun.user.service.IShopService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.time.Year;
import java.util.Date;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author usian
 * @since 2022-10-25
 */
@Slf4j
@Service
public class ShopServiceImpl extends ServiceImpl<ShopMapper, Shop> implements IShopService {



    @Autowired
    private ShopMapper shopMapper;

    private static final Date time1=new Date();

    @Override
    public List<Shop> findAll() {
        QueryWrapper<Shop> queryWrapper=new QueryWrapper<>();
        queryWrapper.lambda()
                .gt(Shop::getExceptionShop,0)
                .lt(Shop::getCreateTime,time1);
        List<Shop> shopList = shopMapper.selectList(queryWrapper);
        if (CollectionUtils.isEmpty(shopList)){
            log.info("数据为空");
        }
        return shopList;
    }
}
